/*
 * @Author: xiaosihan 
 * @Date: 2022-03-31 11:22:15 
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2022-09-28 16:24:15
 */


import { clamp, degToRad, generateUUID, smoothstep } from "three/src/math/MathUtils";
import FlyLine from "./FlyLine";
import btn1PNG from "./img/1.png";
import menu1PNG from "./img/menu1.png";
import menu2PNG from "./img/menu2.png";
import menu3PNG from "./img/menu3.png";
import menu4PNG from "./img/menu4.png";
import menuIconPNG from "./img/menuIcon.png";


import costTrendIconPNG from "./img/costTrendIcon.png";
import experienceCabinIconPNG from "./img/experienceCabinIcon.png"; // 智能审核体验舱
import flycheck2IconPNG from "./img/flycheck2Icon.png";
import fundSupervisionPathIconPNG from "./img/fundSupervisionPathIcon.png";
import infoMoniterIconPNG from "./img/infoMoniterIcon.png";
import internetRegulationIconPNG from "./img/internetRegulationIcon.png";
import mobileWardRoundIconPNG from "./img/mobileWardRoundIcon.png";
import regionIconPNG from "./img/regionIcon.png";
import superviseIconPNG from "./img/superviseIcon.png"; // 国家局大屏图标
import violationIconPNG from "./img/violationIcon.png";
import xinjiangInfoMoniterIconPNG from "./img/xinjiangInfoMoniterIcon.png";


import ImgSprite from "./ImgSprite/ImgSprite";




import utils from "@utils";
import { BoxGeometry, BufferGeometry, CircleGeometry, Color, Group, LinearFilter, Mesh, RGBAFormat, ShaderMaterial, Sprite, Vector2, Vector3, WebGLRenderTarget } from "three";
import ThreeBase from "three-base";
import Transition from "three-base/Transition";
import threeLoader from "three-base/threeLoader";
import { boxShader, floorShader } from "./shader";


/**
 *  指挥中心 v3
 *
 * @class HomeRenderer
 * @extends {ThreeBase}
 */
class HomeRenderer extends ThreeBase {

    static tempVector3 = new Vector3(0, 0, 0);

    constructor() {
        super();
        window.homeRenderer = this;
    }

    uuid = generateUUID();

    //蓝色的地板
    floor = (() => {
        const floorGeometry = new CircleGeometry(50, 100, 0, Math.PI * 2)
        floorGeometry.rotateX(degToRad(-90));
        const floor = new Mesh(floorGeometry, floorShader);
        floor.position.set(0, -0.01, 0);
        this.scene.add(floor);
        return floor;
    })();

    // 标签按钮分组
    btnGroup = (() => {
        const btnGroup = new class BtnGroup extends Group { }
        this.scene.add(btnGroup);
        return btnGroup;
    })();

    // 全部方块数组
    boxs = (() => {
        const center = new Vector3();
        const boxGeo = new BoxGeometry(1, 1, 1, 1, 1, 1);
        boxGeo.translate(0, 0.5, 0);
        boxGeo.rotateX(degToRad(0));

        const position = boxGeo.getAttribute("position");
        const uv = boxGeo.getAttribute("uv");
        const uv2 = uv.clone();

        for (let i = 0; i < position.count; i++) {
            uv2.setY(i, position.getY(i));
        }

        boxGeo.setAttribute("uv2", uv2);

        const boxs = new Group();

        for (let i = -20; i <= 20; i++) {
            for (let ii = -20; ii <= 20; ii++) {

                // 中间位置空出来
                if (Math.abs(i) < 2 && Math.abs(ii) < 2 && (i !== 0 || ii !== 0)) {
                    continue;
                }

                if (new Vector3(i, 0, ii).length() > 14) {
                    continue;
                }

                const boxMesh = new Mesh(boxGeo, boxShader.clone());
                boxMesh.renderOrder = 2;

                boxMesh.position.set(i, 0, ii);
                boxMesh.material.uniforms.color.value.set("#3280AE");
                boxMesh.material.uniforms.distanceToCenter.value = boxMesh.position.distanceTo(center);

                const size = utils.rand(50, 60) / 100;
                const offset = utils.rand(-20, 20) / 100;
                boxMesh.position.set(i - offset, 0, ii - offset);
                boxMesh.scale.set(size, 1 - size, size);
                boxMesh.userData = {
                    x: i,
                    z: ii,
                    offset,
                    scaleY: (1 - size) * 1.2,
                    level2Btn: false, // 是否是二级菜单
                    parent: "", // 三级菜单的父级分类
                    level3Btn: false // 是否是三级菜单
                }

                boxMesh.addEventListener("click", () => {
                    console.log("x", i, "z", ii, "scale", boxMesh.scale);
                });

                boxs.add(boxMesh);
            }
        }

        this.scene.add(boxs);
        return boxs;
    })();

    // 设置几个用于点缀的方块
    decorationBoxs = (() => {
        const colors = ["#59B4BD", "#896275", "#AF7883", "#5563A8", "#46A3D0", "#3B7EB6", "#356E9D", "#4C6CBD", "#3993A9"];
        [
            { x: 0, z: 2 },
            { x: 0, z: 5 },
            { x: 0, z: -5 },
            { x: -3, z: -1 },
            { x: -2, z: 2 },
            { x: 2, z: 1 },
            { x: -4, z: -3 },
            { x: -6, z: 2 },
            { x: -3, z: 6 },
            { x: 5, z: 2 },
        ].map(item => {
            this.boxs.traverse(obj => {
                const boxMesh = obj as Mesh;
                if (boxMesh.isMesh && boxMesh.userData.x === item.x && boxMesh.userData.z === item.z) {

                    (boxMesh.material as ShaderMaterial).uniforms.color.value.set(colors[utils.rand(0, colors.length - 1)]);
                    (boxMesh.material as ShaderMaterial).uniforms.distanceToCenter.value = 1.0;

                }
            });
        });
    })();

    // 中间的大立方体 
    centerBox = (() => {
        const centerBox = this.boxs.children.find(obj => obj.userData.x === 0 && obj.userData.z === 0) as Mesh<BufferGeometry, ShaderMaterial>;

        centerBox.position.set(0, 0, 0);
        centerBox.scale.set(1, 2, 1);
        centerBox.material.uniforms.color.value.set("#8AE1EC");
        centerBox.material.uniforms.distanceToCenter.value = 0;

        Object.assign(centerBox.userData, {
            cursor: "pointer"
        });

        const imgSprite = new ImgSprite(btn1PNG, 0.8);

        this.btnGroup.add(imgSprite);

        imgSprite.position.set(0, 2.5, 0);

        imgSprite.userData = {
            cursor: "pointer"
        }

        const click = () => {
            // 设置波浪的中心位置
            this.waveCenter.set(0, 0);
            this.playWave();
            // 每个主题的缓动显示进度显示进度
            this.closeLevel3();

            this.transShowPrograss.set({ centerIndenty: 1 });

            this.setLookAt({
                center: new Vector3(0, 0, 0),
                position: new Vector3(6, 11, 6),
            });

            // 修改每个方块的颜色的 以 0,4 为中心
            const center = new Vector3(0, 0, 4);
            this.boxs.traverse(box => {
                if ((box as Mesh).isMesh) {
                    const { x, z } = box.userData;
                    if (x !== 0 && z !== 0) {
                        ((box as Mesh).material as ShaderMaterial).uniforms.distanceToCenter.value = box.position.distanceTo(new Vector3(0, 0, 0));
                    }
                }
            });
        }

        imgSprite.addEventListener("click", click);
        centerBox.addEventListener("click", click);
        return centerBox;
    })();

    // 飞线组
    flyLineGroup = (() => {
        const flyLineGroup = new Group();
        this.scene.add(flyLineGroup);
        return flyLineGroup;
    })();

    // 贝塞尔曲线计算
    computerBezier(arr: [number, number, number, number], t: number) {
        var ut = 1 - t;
        var a1 = arr[1] * ut + arr[2] * t;
        var result = ((arr[0] * ut + arr[1] * t) * ut + a1 * t) * ut + (a1 * ut + (arr[2] * ut + arr[3] * t) * t) * t;
        return result;
    }

    // 展开医保监管指挥中心菜单
    openFealthCareCenter = async () => {

        if (this.getCamera().position.distanceTo(new Vector3(7.42, 4, 8.58)) < 0.1) {
            this.centerBox.dispatchEvent({ type: "click" } as never);
            this.switchLevel2LableStyle(false);
            return;
        }

        this.switchLevel2LableStyle(true);

        this.setLookAt({
            center: new Vector3(3, 0, 4),
            position: new Vector3(7.42, 4, 8.58)
        });

        const fealthCareCenter = this.transShowPrograss.get("fealthCareCenter");
        // 等待相机动画完成
        if (fealthCareCenter === 0) {
            await new Promise(resolve => setTimeout(resolve, 500));
            this.closeLevel3();
            this.transShowPrograss.set({ fealthCareCenter: 1 });
        }

        this.waveCenter.set(0.2, 0.3); // 设置波浪的中心位置
        this.playWave();

        // 修改每个方块的颜色的 以 2,3 为中心
        const center = new Vector3(2, 0, 3);
        this.boxs.traverse(box => {
            if ((box as Mesh).isMesh) {
                const { x, z } = box.userData;
                if (!(x === 0 && z === 0)) {
                    ((box as Mesh).material as ShaderMaterial).uniforms.distanceToCenter.value = box.position.distanceTo(center);
                }
            }
        });

    }

    // 展开基金运行监测菜单
    openFundDetection = async () => {

        if (this.getCamera().position.distanceTo(new Vector3(-0.89, 4, 12.96)) < 0.1) {
            this.centerBox.dispatchEvent({ type: "click" } as never);
            this.switchLevel2LableStyle(false);
            return;
        }

        this.switchLevel2LableStyle(true);

        this.setLookAt({
            center: new Vector3(0, 0, 6),
            position: new Vector3(-0.89, 4, 12.96)
        });

        const fundDetection = this.transShowPrograss.get("fundDetection");

        // 等待相机动画完成
        if (fundDetection === 0) {
            await new Promise(resolve => setTimeout(resolve, 500));
            this.closeLevel3();
            this.transShowPrograss.set({ fundDetection: 1 });
        }

        this.waveCenter.set(0, 0.4); // 设置波浪的中心位置
        this.playWave();

        // 修改每个方块的颜色的 以 0,4 为中心
        const center = new Vector3(0, 0, 4);
        this.boxs.traverse(box => {
            if ((box as Mesh).isMesh) {
                const { x, z } = box.userData;
                if (!(x === 0 && z === 0)) {
                    ((box as Mesh).material as ShaderMaterial).uniforms.distanceToCenter.value = box.position.distanceTo(center);
                }
            }
        });

    }

    openPublicService = async () => {
        if (this.getCamera().position.distanceTo(new Vector3(9.133, 4.976, -6.488)) < 0.1) {
            this.centerBox.dispatchEvent({ type: "click" } as never);
            this.switchLevel2LableStyle(false);
            return;
        }

        this.switchLevel2LableStyle(true);

        this.setLookAt({
            center: new Vector3(1.96, 0, -1.189),
            position: new Vector3(9.133, 4.976, -6.488)
        });

        const publicService = this.transShowPrograss.get("publicService");

        // 等待相机动画完成
        if (publicService === 0) {
            await new Promise(resolve => setTimeout(resolve, 500));
            this.closeLevel3();
            this.transShowPrograss.set({ publicService: 1 });
        }

        this.waveCenter.set(0.3, -0.2); // 设置波浪的中心位置
        this.playWave();

        // 修改每个方块的颜色的 以 5, -2 为中心
        const center = new Vector3(3, 0, -2);
        this.boxs.traverse(box => {
            if ((box as Mesh).isMesh) {
                const { x, z } = box.userData;
                if (!(x === 0 && z === 0)) {
                    ((box as Mesh).material as ShaderMaterial).uniforms.distanceToCenter.value = box.position.distanceTo(center);
                }
            }
        });
    }

    openMedicalServices = async () => {

        if (this.getCamera().position.distanceTo(new Vector3(-8.983, 4.815, 9.234)) < 0.1) {
            this.centerBox.dispatchEvent({ type: "click" } as never);
            this.switchLevel2LableStyle(false);
            return;
        }

        this.switchLevel2LableStyle(true);

        this.setLookAt({
            center: new Vector3(-2.892, 0, 2.433),
            position: new Vector3(-8.983, 4.815, 9.234)
        });

        const medicalServices = this.transShowPrograss.get("medicalServices");

        // 等待相机动画完成
        if (medicalServices === 0) {
            await new Promise(resolve => setTimeout(resolve, 500));
            this.closeLevel3();
            this.transShowPrograss.set({ medicalServices: 1 });
        }

        this.waveCenter.set(-0.4, 0.4); // 设置波浪的中心位置
        this.playWave();

        // 修改每个方块的颜色的 以 -4, 4 为中心
        const center = new Vector3(-4, 0, 4);
        this.boxs.traverse(box => {
            if ((box as Mesh).isMesh) {
                const { x, z } = box.userData;
                if (!(x === 0 && z === 0)) {
                    ((box as Mesh).material as ShaderMaterial).uniforms.distanceToCenter.value = box.position.distanceTo(center);
                }
            }
        });
    }

    openThreeHospital = async () => {
        if (this.getCamera().position.distanceTo(new Vector3(11.062, 5.236, -1.04)) < 0.1) {
            this.centerBox.dispatchEvent({ type: "click" } as never);
            this.switchLevel2LableStyle(false);
            return;
        }

        this.switchLevel2LableStyle(true);

        this.setLookAt({
            center: new Vector3(2.328, 0, -0.274),
            position: new Vector3(11.062, 5.236, -1.04)
        });

        const threeHospital = this.transShowPrograss.get("threeHospital");

        // 等待相机动画完成
        if (threeHospital === 0) {
            await new Promise(resolve => setTimeout(resolve, 500));
            this.closeLevel3();
            this.transShowPrograss.set({ threeHospital: 1 });
        }

        this.waveCenter.set(0.5, -0.1); // 设置波浪的中心位置
        this.playWave();

        // 修改每个方块的颜色的 以 5, -1 为中心
        const center = new Vector3(5, 0, -1);
        this.boxs.traverse(box => {
            if ((box as Mesh).isMesh) {
                const { x, z } = box.userData;
                if (!(x === 0 && z === 0)) {
                    ((box as Mesh).material as ShaderMaterial).uniforms.distanceToCenter.value = box.position.distanceTo(center);
                }
            }
        });

    }

    threeHospital = () => {
        console.log("点击了二级菜单4");

    }

    openPurchase = async () => {
        if (this.getCamera().position.distanceTo(new Vector3(-11.291, 4.529, 2.535)) < 0.1) {
            this.centerBox.dispatchEvent({ type: "click" } as never);
            this.switchLevel2LableStyle(false);
            return;
        }

        this.switchLevel2LableStyle(true);

        this.setLookAt({
            center: new Vector3(-2.888, 0, 0.294),
            position: new Vector3(-11.291, 4.529, 2.535)
        });

        const purchase = this.transShowPrograss.get("purchase");

        // 等待相机动画完成
        if (purchase === 0) {
            await new Promise(resolve => setTimeout(resolve, 500));
            this.closeLevel3();
            this.transShowPrograss.set({ purchase: 1 });
        }

        this.waveCenter.set(-0.4, 0.1); // 设置波浪的中心位置
        this.playWave();

        // 修改每个方块的颜色的 以 -4, 1 为中心
        const center = new Vector3(-4, 0, 1);
        this.boxs.traverse(box => {
            if ((box as Mesh).isMesh) {
                const { x, z } = box.userData;
                if (!(x === 0 && z === 0)) {
                    ((box as Mesh).material as ShaderMaterial).uniforms.distanceToCenter.value = box.position.distanceTo(center);
                }
            }
        });
    }

    openAgreementPay = async () => {

        if (this.getCamera().position.distanceTo(new Vector3(-12.65, 4, -5.74)) < 0.1) {
            this.centerBox.dispatchEvent({ type: "click" } as never);
            this.switchLevel2LableStyle(false);
            return;
        }

        this.switchLevel2LableStyle(true);

        this.setLookAt({
            center: new Vector3(-4.83, 0, -1.38),
            position: new Vector3(-12.65, 4, -5.74)
        });

        const agreementPay = this.transShowPrograss.get("agreementPay");

        // 等待相机动画完成
        if (agreementPay === 0) {
            await new Promise(resolve => setTimeout(resolve, 500));
            this.closeLevel3();
            this.transShowPrograss.set({ agreementPay: 1 });
        }

        this.waveCenter.set(-0.5, -0.2); // 设置波浪的中心位置
        this.playWave();

        // 修改每个方块的颜色的 以 -5, -2 为中心
        const center = new Vector3(-5, 0, -2);
        this.boxs.traverse(box => {
            if ((box as Mesh).isMesh) {
                const { x, z } = box.userData;
                if (!(x === 0 && z === 0)) {
                    ((box as Mesh).material as ShaderMaterial).uniforms.distanceToCenter.value = box.position.distanceTo(center);
                }
            }
        });
    }

    openHealthAgency = async () => {

        if (this.getCamera().position.distanceTo(new Vector3(6.892, 4.101, -10.457)) < 0.1) {
            this.centerBox.dispatchEvent({ type: "click" } as never);
            this.switchLevel2LableStyle(false);
            return;
        }

        this.switchLevel2LableStyle(true);

        this.setLookAt({
            center: new Vector3(1.957, 0, -2.513),
            position: new Vector3(6.892, 4.101, -10.457)
        });

        const healthAgency = this.transShowPrograss.get("healthAgency");

        // 等待相机动画完成
        if (healthAgency === 0) {
            await new Promise(resolve => setTimeout(resolve, 500));
            this.closeLevel3();
            this.transShowPrograss.set({ healthAgency: 1 });
        }

        this.waveCenter.set(0.3, -0.5); // 设置波浪的中心位置
        this.playWave();

        // 修改每个方块的颜色的 以 3, -5 为中心
        const center = new Vector3(3, 0, -5);
        this.boxs.traverse(box => {
            if ((box as Mesh).isMesh) {
                const { x, z } = box.userData;
                if (!(x === 0 && z === 0)) {
                    ((box as Mesh).material as ShaderMaterial).uniforms.distanceToCenter.value = box.position.distanceTo(center);
                }
            }
        });
    }

    openMedicinePrice = async () => {
        if (this.getCamera().position.distanceTo(new Vector3(-5.436, 3.923, -10.604)) < 0.1) {
            this.centerBox.dispatchEvent({ type: "click" } as never);
            this.switchLevel2LableStyle(false);
            return;
        }

        this.switchLevel2LableStyle(true);

        this.setLookAt({
            center: new Vector3(-1.317, 0, -2.124),
            position: new Vector3(-5.436, 3.923, -10.604)
        });

        const medicinePrice = this.transShowPrograss.get("medicinePrice");

        // 等待相机动画完成
        if (medicinePrice === 0) {
            await new Promise(resolve => setTimeout(resolve, 500));
            this.closeLevel3();
            this.transShowPrograss.set({ medicinePrice: 1 });
        }

        this.waveCenter.set(-0.2, -0.4); // 设置波浪的中心位置
        this.playWave();

        // 修改每个方块的颜色的 以 -2, -4 为中心
        const center = new Vector3(-2, 0, -4);
        this.boxs.traverse(box => {
            if ((box as Mesh).isMesh) {
                const { x, z } = box.userData;
                if (!(x === 0 && z === 0)) {
                    ((box as Mesh).material as ShaderMaterial).uniforms.distanceToCenter.value = box.position.distanceTo(center);
                }
            }
        });
    }

    // 二级菜单按钮 从boxs 找几个修改颜色
    btnItem = (() => {
        // #8AE1EC 亮绿色
        // #59B4BD 
        [
            { x: 2, z: 3, color: "#8AE1EC", name: "fealthCareCenter", hasFlyLine: true, img: menu1PNG, greyImg: menu1PNG, onClick: this.openFealthCareCenter },
            { x: 0, z: 6, color: "#896275", name: "fundDetection", hasFlyLine: true, img: menu2PNG, greyImg: menu2PNG, onClick: this.openFundDetection },
            { x: 3, z: -2, color: "#AF7883", name: "publicService", hasFlyLine: false, img: menu3PNG, greyImg: menu3PNG, onClick: this.openPublicService },
            { x: -4, z: 4, color: "#5563A8", name: "medicalServices", hasFlyLine: false, img: menu4PNG, greyImg: menu4PNG, onClick: this.openMedicalServices },
            { x: 5, z: -1, color: "#46A3D0", name: "threeHospital", hasFlyLine: true, img: menu4PNG, greyImg: menu4PNG, onClick: this.openThreeHospital },
            { x: -4, z: 1, color: "#3B7EB6", name: "purchase", hasFlyLine: true, img: menu1PNG, greyImg: menu1PNG, onClick: this.openPurchase },
            { x: -5, z: -2, color: "#356E9D", name: "agreementPay", hasFlyLine: false, img: menu2PNG, greyImg: menu2PNG, onClick: this.openAgreementPay },
            { x: 3, z: -5, color: "#4C6CBD", name: "healthAgency", hasFlyLine: true, img: menu3PNG, greyImg: menu3PNG, onClick: this.openHealthAgency },
            { x: -2, z: -4, color: "#3993A9", name: "medicinePrice", hasFlyLine: false, img: menu4PNG, greyImg: menu4PNG, onClick: this.openMedicinePrice },
        ].map(btn => {

            this.boxs.traverse(obj => {
                const boxMesh = obj as Mesh;
                if (boxMesh.isMesh && boxMesh.userData.x === btn.x && boxMesh.userData.z === btn.z) {

                    (boxMesh.material as ShaderMaterial).uniforms.gradientColor1.value.set(btn.color);

                    // 立方体 生长动画执行完成后
                    boxMesh.scale.set(0.5, 1.4, 0.5);
                    boxMesh.name = btn.name;
                    boxMesh.userData = {
                        originColor: btn.color,
                        activeColor: "#8AE1EC",
                        ...boxMesh.userData,
                        name: btn.name,
                        scaleY: 1.5,
                        level2Btn: true // 是否是二级菜单
                    }

                    // 标签菜单
                    const imgSprite = new ImgSprite(btn.img);

                    imgSprite.userData = {
                        greyImg: btn.greyImg, // 置灰时显示的图片
                        activeImg: btn.img, // 选中时的图片
                        name: btn.name,
                        level2lable: true // 是否是二级菜单标签
                    }

                    this.btnGroup.add(imgSprite);

                    imgSprite.onBeforeRender = () => {
                        const { x, z } = boxMesh.position;
                        const { y } = boxMesh.scale;
                        imgSprite.position.set(x, y + 0.5, z);
                    }

                    //添加事件
                    if (btn.onClick) {
                        boxMesh.addEventListener("click", btn.onClick);
                        Object.assign(boxMesh.userData, { cursor: "pointer" });
                        imgSprite.addEventListener("click", btn.onClick);
                        Object.assign(imgSprite.userData, { cursor: "pointer" });
                    }


                    // // 添加二级菜单的飞线
                    if (btn.hasFlyLine) {
                        const { x, z } = boxMesh.position;

                        const flyLine = new FlyLine({
                            start: { x: 0, y: 2, z: 0 },
                            end: { x: x, y: 1.4, z: z },
                            radius: 0.01,
                        });

                        flyLine.lineColor = "#8AE1EC";
                        flyLine.userData = {
                            parent: "",
                            name: btn.name,
                            level2Btn: true, // 是否是二级菜单线
                            level3Btn: false // 是否是三级菜单线
                        }

                        this.flyLineGroup.add(flyLine);
                    }

                }
            });

        });
    })();

    // 破浪起伏的中心位置 0-1;
    waveCenter = new Vector2(0, 0);

    tempVector2 = new Vector2();

    bezier = [0.55, 2, 1, 1];

    _Xbezier: [number, number, number, number] = [0, this.bezier[0], this.bezier[2], 1];
    _Ybezier: [number, number, number, number] = [0, this.bezier[1], this.bezier[3], 1];

    // 获取x 对应的 y值
    getBezierYByX(x: number) {
        // 斜率
        let t = 0;
        // 无限接近法 求斜率t
        while (this.computerBezier(this._Xbezier, t + 0.1) < x) {
            t += 0.1;
        }
        while (this.computerBezier(this._Xbezier, t + 0.01) < x) {
            t += 0.01;
        }
        t = clamp(t, 0, 1);
        return this.computerBezier(this._Ybezier, t);
    }

    glowRenderTarget = new WebGLRenderTarget(128, 128, { minFilter: LinearFilter, magFilter: LinearFilter, format: RGBAFormat });

    // 三级菜单和标签
    btn_l3 = (() => {

        const btn_l3 = new Group();
        // #E0BE7D 金色
        // #59B4BD 蓝色

        [
            { x: 0, z: 4, color: "#E0BE7D", name: "菜单1", hasFlyLine: true, textImg: menuIconPNG, img: flycheck2IconPNG, onClick: () => console.log("菜单1"), parent: "fealthCareCenter" }, // 菜单1
            { x: 2, z: 6, color: "#8AE1EC", name: "菜单2", hasFlyLine: true, textImg: menuIconPNG, img: superviseIconPNG, onClick: () => console.log("菜单2"), parent: "fealthCareCenter" }, // 菜单2
            { x: 4, z: 6, color: "#E0BE7D", name: "菜单3", hasFlyLine: true, textImg: menuIconPNG, img: internetRegulationIconPNG, onClick: () => console.log("菜单3"), parent: "fealthCareCenter" }, //菜单3
            { x: 5, z: 5, color: "#8AE1EC", name: "菜单4", hasFlyLine: true, textImg: menuIconPNG, img: mobileWardRoundIconPNG, onClick: () => console.log("菜单4"), parent: "fealthCareCenter" }, // 菜单4
            { x: 5, z: 3, color: "#E0BE7D", name: " 菜单5", hasFlyLine: true, textImg: menuIconPNG, img: experienceCabinIconPNG, onClick: () => console.log("菜单5"), parent: "fealthCareCenter" }, // 菜单5

            { x: 3, z: 4, color: "#8AE1EC", name: "菜单6", hasFlyLine: true, textImg: menuIconPNG, img: regionIconPNG, onClick: () => console.log("菜单6"), parent: "fundDetection" }, // 菜单6
            { x: 3, z: 7, color: "#E0BE7D", name: "菜单7", hasFlyLine: true, textImg: menuIconPNG, img: costTrendIconPNG, onClick: () => console.log("菜单7"), parent: "fundDetection" }, // 菜单7
            { x: 1, z: 8, color: "#8AE1EC", name: "菜单8", hasFlyLine: true, textImg: menuIconPNG, img: infoMoniterIconPNG, onClick: () => console.log("菜单8"), parent: "fundDetection" }, // 菜单8
            { x: -2, z: 7, color: "#E0BE7D", name: "菜单9", hasFlyLine: true, textImg: menuIconPNG, img: violationIconPNG, onClick: () => console.log("菜单9"), parent: "fundDetection" }, // 菜单9
            { x: -3, z: 5, color: "#8AE1EC", name: "菜单10", hasFlyLine: true, textImg: menuIconPNG, img: xinjiangInfoMoniterIconPNG, onClick: () => console.log("菜单10"), parent: "fundDetection" }, // 菜单10

            { x: -7, z: -4, color: "#E0BE7D", name: "菜单11", hasFlyLine: true, textImg: menuIconPNG, img: fundSupervisionPathIconPNG, onClick: () => console.log("菜单11"), parent: "agreementPay" }, // 菜单11

            { x: 7, z: 1, color: "#8AE1EC", name: "菜单12", hasFlyLine: true, textImg: menuIconPNG, img: fundSupervisionPathIconPNG, onClick: () => console.log("菜单12"), parent: "threeHospital" }, // 菜单12
            { x: 6, z: -3, color: "#E0BE7D", name: "菜单13", hasFlyLine: true, textImg: menuIconPNG, img: flycheck2IconPNG, onClick: () => console.log("菜单13"), parent: "threeHospital" }, // 菜单13

            { x: 5, z: -3, color: "#8AE1EC", name: "菜单14", hasFlyLine: true, textImg: menuIconPNG, img: superviseIconPNG, onClick: () => console.log("菜单14"), parent: "publicService" }, // 菜单14

            { x: 5, z: -6, color: "#E0BE7D", name: "菜单15", hasFlyLine: true, textImg: menuIconPNG, img: internetRegulationIconPNG, onClick: () => console.log("菜单15"), parent: "healthAgency" }, //菜单15
            { x: 3, z: -7, color: "#8AE1EC", name: "菜单16", hasFlyLine: true, textImg: menuIconPNG, img: mobileWardRoundIconPNG, onClick: () => console.log("菜单16"), parent: "healthAgency" }, // 菜单16

            // medicinePrice
            { x: -2, z: -6, color: "#E0BE7D", name: " 菜单17", hasFlyLine: true, textImg: menuIconPNG, img: experienceCabinIconPNG, onClick: () => console.log("菜单17"), parent: "medicinePrice" }, // 菜单17
            { x: -4, z: -5, color: "#8AE1EC", name: "菜单18", hasFlyLine: true, textImg: menuIconPNG, img: regionIconPNG, onClick: () => console.log("菜单18"), parent: "medicinePrice" }, // 菜单18

            // purchase
            { x: -7, z: 0, color: "#E0BE7D", name: " 菜单19", hasFlyLine: true, textImg: menuIconPNG, img: experienceCabinIconPNG, onClick: () => console.log("菜单19"), parent: "purchase" }, // 菜单19
            { x: -6, z: 3, color: "#8AE1EC", name: "菜单20", hasFlyLine: true, textImg: menuIconPNG, img: regionIconPNG, onClick: () => console.log("菜单20"), parent: "purchase" }, // 菜单20

            // medicalServices
            { x: -7, z: 3, color: "#E0BE7D", name: "菜单21", hasFlyLine: true, textImg: menuIconPNG, img: costTrendIconPNG, onClick: () => console.log("菜单21"), parent: "medicalServices" }, // 菜单21
            { x: -6, z: 5, color: "#8AE1EC", name: "菜单22", hasFlyLine: true, textImg: menuIconPNG, img: infoMoniterIconPNG, onClick: () => console.log("菜单22"), parent: "medicalServices" }, // 菜单22
            { x: -4, z: 6, color: "#E0BE7D", name: "菜单23", hasFlyLine: true, textImg: menuIconPNG, img: violationIconPNG, onClick: () => console.log("菜单23"), parent: "medicalServices" }, // 菜单23

        ].map(btn => {

            this.boxs.traverse(obj => {
                const boxMesh = obj as Mesh;
                if (boxMesh.isMesh && boxMesh.userData.x === btn.x && boxMesh.userData.z === btn.z) {

                    (boxMesh.material as ShaderMaterial).uniforms.gradientColor1.value.set(btn.color);
                    (boxMesh.material as ShaderMaterial).uniforms.itmeMap.value = threeLoader.textureLoader.load(btn.img);

                    const scaleY = utils.rand(4, 8) / 10;

                    // 立方体 生长动画执行完成后
                    boxMesh.scale.set(0.5, scaleY, 0.5);
                    boxMesh.userData = {
                        ...boxMesh.userData,
                        scaleY: 1,
                        level2Btn: false, // 是否是二级菜单
                        parent: btn.parent, // 三级菜单的父级分类
                        level3Btn: true // 是否是三级菜单
                    }

                    //添加事件
                    if (btn.onClick) {
                        boxMesh.addEventListener("click", btn.onClick);
                        Object.assign(boxMesh.userData, { cursor: "pointer" });
                    }

                    // 创建标签
                    const textLable = new ImgSprite(btn.textImg, 0.16);
                    textLable.position.set(0, 0, 0);
                    textLable.renderOrder = 3;

                    textLable.addEventListener("click", btn.onClick);

                    textLable.onBeforeRender = () => {
                        const { x, z } = boxMesh.position;
                        const { y } = boxMesh.scale;
                        textLable.position.set(x, y + 0.1, z);
                    }

                    textLable.userData = {
                        cursor: "pointer",
                        x: btn.x,
                        z: btn.z,
                        scaleY: scaleY,
                        level2Btn: false, // 是否是二级菜单
                        parent: btn.parent, // 三级菜单的父级分类
                        level3Btn: true // 是否是三级菜单
                    }
                    btn_l3.add(textLable);


                    // 添加三级菜单的飞线
                    if (btn.hasFlyLine) {

                        const { x, z } = boxMesh.position;

                        const parentMesh = this.boxs.getObjectByName(btn.parent)!;

                        const { x: Px, z: Pz } = parentMesh.position;
                        const { scaleY: PscaleY } = parentMesh.userData;

                        const flyLine = new FlyLine({
                            start: { x: Px, y: PscaleY + 0.2, z: Pz },
                            end: { x: x, y: scaleY, z: z },
                            radius: 0.01,
                        });

                        flyLine.lineColor = "#8AE1EC";
                        flyLine.userData = {
                            parent: btn.parent, // 三级菜单的父级分类
                            name: btn.name,
                            level2Btn: false, // 是否是二级菜单线
                            level3Btn: true // 是否是三级菜单线
                        }

                        this.flyLineGroup.add(flyLine);
                    }

                }
            });

        });

        this.scene.add(btn_l3);

        return btn_l3;
    })();

    // 每个主题的缓动显示进度显示进度
    transShowPrograss = (() => {
        const transShowPrograss = new Transition({
            home: 0, // 主菜单
            wave: 1, // 波浪动画进度
            healthAgency: 0, // "医保经办管理中心"
            fealthCareCenter: 0,// "医保监管指挥中心"
            fundDetection: 0, // "基金运行监测中心"
            agreementPay: 0, // "协议支付监管中心"
            purchase: 0, // "招标采购管理中心"
            medicalServices: 0, // "医药服务管理中心"
            publicService: 0, // "公共服务监测中心"
            medicinePrice: 0,// "医药价格监测中心"
            threeHospital: 0, // "三医联动控制中心"
            centerIndenty: 1 // 地板中心的发光强度
        });

        transShowPrograss.onChange(({
            home,
            wave,
            healthAgency, // "医保经办管理中心  展开进度
            fealthCareCenter,// "医保监管指挥中心  展开进度
            fundDetection, // "基金运行监测中心  展开进度
            agreementPay, // "协议支付监管中心  展开进度
            purchase, // "招标采购管理中心  展开进度
            medicalServices, // "医药服务管理中心  展开进度
            publicService, // "公共服务监测中心  展开进度
            medicinePrice,// "医药价格监测中心  展开进度
            threeHospital, // "三医联动控制中心  展开进度
            centerIndenty // 地板中心的发光强度
        }) => {

            this.boxs.traverse(mesh => {
                if ((mesh as Mesh).isMesh) {
                    const { x, z, scaleY, name, level2Btn, level2lable, parent, level3Btn, originColor, activeColor } = mesh.userData;

                    if (x === 0 && z === 0) {

                    } else {
                        let t = 0;

                        if (this.tempVector2.set(x, z).divideScalar(20).length() < home - 0.1) {
                            t = 1;
                        } else if (this.tempVector2.set(x, z).divideScalar(20).length() > home + 0.1) {
                            t = 0;
                        } else {
                            t = 1 - smoothstep(this.tempVector2.set(x, z).divideScalar(20).length(), home - 0.1, home + 0.1);
                        }

                        // 点击中心点时的波浪起伏的值
                        let t2 = (1 - smoothstep(Math.abs(this.tempVector2.set(x, z).divideScalar(20).sub(this.waveCenter).length() - wave), 0, 0.2));

                        // 在中心点的位置就没有波浪效果
                        if (this.tempVector2.set(x, z).divideScalar(20).equals(this.waveCenter)) {
                            t2 = 0;
                        }

                        // 波浪动画播放
                        mesh.scale.setY(scaleY * ((this.getBezierYByX(t)) + (t2 * 0.2)));

                        // 二级菜单就给材质设置渐变色进度值
                        if (level2Btn) {

                            if (
                                (name === "fealthCareCenter" && fealthCareCenter > 0) || // "一级菜单1  展开进度
                                (name === "healthAgency" && healthAgency > 0) ||         // "一级菜单2  展开进度
                                (name === "fundDetection" && fundDetection > 0) ||       // "一级菜单3  展开进度
                                (name === "agreementPay" && agreementPay > 0) ||         // "一级菜单4  展开进度
                                (name === "purchase" && purchase > 0) ||                 // "一级菜单5  展开进度
                                (name === "medicalServices" && medicalServices > 0) ||   // "一级菜单6  展开进度
                                (name === "publicService" && publicService > 0) ||       // "一级菜单7  展开进度
                                (name === "medicinePrice" && medicinePrice > 0) ||       // "一级菜单8  展开进度
                                (name === "threeHospital" && threeHospital > 0) ||       // "一级菜单9  展开进度
                                (
                                    fealthCareCenter === 0 &&
                                    healthAgency === 0 &&
                                    fundDetection === 0 &&
                                    agreementPay === 0 &&
                                    purchase === 0 &&
                                    medicalServices === 0 &&
                                    publicService === 0 &&
                                    medicinePrice === 0 &&
                                    threeHospital === 0
                                )
                            ) {
                                mesh.scale.set(0.8, scaleY * Math.min(home, wave), 0.8);
                                if (Math.max(fealthCareCenter, healthAgency, fundDetection, agreementPay, purchase, medicalServices, publicService, medicinePrice, threeHospital) === 0) {
                                    ((mesh as Mesh).material as ShaderMaterial).uniforms.gradientColor1.value.set(originColor);
                                    ((mesh as Mesh).material as ShaderMaterial).uniforms.gradientProgress.value = 1;
                                } else {
                                    ((mesh as Mesh).material as ShaderMaterial).uniforms.gradientColor1.value.set(activeColor);
                                    ((mesh as Mesh).material as ShaderMaterial).uniforms.gradientProgress.value = t;
                                }
                            } else {
                                ((mesh as Mesh).material as ShaderMaterial).uniforms.gradientColor1.value.set(originColor);
                                ((mesh as Mesh).material as ShaderMaterial).uniforms.gradientProgress.value = 0.5;
                            }
                        }

                        // 三级菜单
                        if (level3Btn) {

                            let t3 = 0;

                            let progess = Math.max(fealthCareCenter, healthAgency, fundDetection, agreementPay, purchase, medicalServices, publicService, medicinePrice, threeHospital);

                            if (this.tempVector2.set(x, z).divideScalar(20).length() < progess - 0.1) {
                                t3 = 1;
                            } else if (this.tempVector2.set(x, z).divideScalar(20).length() > progess + 0.1) {
                                t3 = 0;
                            } else {
                                t3 = 1 - smoothstep(this.tempVector2.set(x, z).divideScalar(20).length(), progess - 0.1, progess + 0.1);
                            }

                            if (
                                (fealthCareCenter > 0 && parent === "fealthCareCenter") ||
                                (healthAgency > 0 && parent === "healthAgency") ||
                                (fundDetection > 0 && parent === "fundDetection") ||
                                (agreementPay > 0 && parent === "agreementPay") ||
                                (purchase > 0 && parent === "purchase") ||
                                (medicalServices > 0 && parent === "medicalServices") ||
                                (publicService > 0 && parent === "publicService") ||
                                (medicinePrice > 0 && parent === "medicinePrice") ||
                                (threeHospital > 0 && parent === "threeHospital")
                            ) {
                                mesh.scale.setY(Math.min(home, wave) * scaleY);
                                ((mesh as Mesh).material as ShaderMaterial).uniforms.gradientProgress.value = Math.min(home, wave);
                            } else {
                                mesh.scale.setY(0.5);
                                ((mesh as Mesh).material as ShaderMaterial).uniforms.gradientProgress.value = 0;
                            }

                        }



                    }

                }
            });

            // 一  二 级菜单标签
            this.btnGroup.traverse(btn => {
                if ((btn as ImgSprite).isSprite) {
                    // (btn as ImgSprite).material.opacity = smoothstep(home, 0.5, 1);
                    const { level2Btn, name } = (btn as ImgSprite).userData;
                    // if (level2Btn) {
                    if (
                        (name === "fealthCareCenter" && fealthCareCenter > 0) || // "医保监管指挥中心  展开进度
                        (name === "healthAgency" && healthAgency > 0) ||         // "医保经办管理中心  展开进度
                        (name === "fundDetection" && fundDetection > 0) ||       // "基金运行监测中心  展开进度
                        (name === "agreementPay" && agreementPay > 0) ||         // "协议支付监管中心  展开进度
                        (name === "purchase" && purchase > 0) ||                 // "招标采购管理中心  展开进度
                        (name === "medicalServices" && medicalServices > 0) ||   // "医药服务管理中心  展开进度
                        (name === "publicService" && publicService > 0) ||       // "公共服务监测中心  展开进度
                        (name === "medicinePrice" && medicinePrice > 0) ||       // "医药价格监测中心  展开进度
                        (name === "threeHospital" && threeHospital > 0) ||       // "三医联动控制中心  展开进度
                        (
                            fealthCareCenter === 0 &&
                            healthAgency === 0 &&
                            fundDetection === 0 &&
                            agreementPay === 0 &&
                            purchase === 0 &&
                            medicalServices === 0 &&
                            publicService === 0 &&
                            medicinePrice === 0 &&
                            threeHospital === 0
                        )
                    ) {
                        this.centerBox.material.uniforms.color.value.set("#8AE1EC");
                        (btn as ImgSprite).material.opacity = smoothstep(home, 0.5, 1);
                    } else {
                        // 中间块的颜色
                        this.centerBox.material.uniforms.color.value.set("#3280AE");
                        (btn as ImgSprite).material.opacity = 0.2;
                    }

                }
            });

            // 三级菜单的标签
            this.btn_l3.traverse(label => {
                if ((label as Sprite).isSprite) {

                    const { x, z, parent } = label.userData;

                    let t3 = 0;
                    let progess = Math.max(fealthCareCenter, healthAgency, fundDetection, agreementPay, purchase, medicalServices, publicService, medicinePrice, threeHospital);
                    if (this.tempVector2.set(x, z).divideScalar(20).length() < progess - 0.1) {
                        t3 = 1;
                    } else if (this.tempVector2.set(x, z).divideScalar(20).length() > progess + 0.1) {
                        t3 = 0;
                    } else {
                        t3 = 1 - smoothstep(this.tempVector2.set(x, z).divideScalar(20).length(), progess - 0.1, progess + 0.1);
                    }

                    if (
                        (fealthCareCenter > 0 && parent === "fealthCareCenter") ||
                        (healthAgency > 0 && parent === "healthAgency") ||
                        (fundDetection > 0 && parent === "fundDetection") ||
                        (agreementPay > 0 && parent === "agreementPay") ||
                        (purchase > 0 && parent === "purchase") ||
                        (medicalServices > 0 && parent === "medicalServices") ||
                        (publicService > 0 && parent === "publicService") ||
                        (medicinePrice > 0 && parent === "medicinePrice") ||
                        (threeHospital > 0 && parent === "threeHospital")
                    ) {
                        (label as ImgSprite).material.opacity = Math.min(home, wave) > 0.8 ? Math.min(home, wave) : 0.0;
                    } else {
                        (label as ImgSprite).material.opacity = 0;
                    }
                }
            });

            // 控制飞线的显示
            let progess = Math.max(fealthCareCenter, healthAgency, fundDetection, agreementPay, purchase, medicalServices, publicService, medicinePrice, threeHospital);

            this.flyLineGroup.traverse(obj => {
                const flyline = obj as FlyLine;
                if (flyline.isFlyLine) {
                    const { level2Btn, parent, level3Btn } = flyline.userData;

                    if (
                        level3Btn && (
                            (parent === "fealthCareCenter" && fealthCareCenter > 0) || // "医保监管指挥中心  展开进度
                            (parent === "healthAgency" && healthAgency > 0) ||         // "医保经办管理中心  展开进度
                            (parent === "fundDetection" && fundDetection > 0) ||       // "基金运行监测中心  展开进度
                            (parent === "agreementPay" && agreementPay > 0) ||         // "协议支付监管中心  展开进度
                            (parent === "purchase" && purchase > 0) ||                 // "招标采购管理中心  展开进度
                            (parent === "medicalServices" && medicalServices > 0) ||   // "医药服务管理中心  展开进度
                            (parent === "publicService" && publicService > 0) ||       // "公共服务监测中心  展开进度
                            (parent === "medicinePrice" && medicinePrice > 0) ||       // "医药价格监测中心  展开进度
                            (parent === "threeHospital" && threeHospital > 0)       // "三医联动控制中心  展开进度
                        )
                    ) {
                        flyline.visible = true;
                    } else if (level2Btn && !parent && progess === 0) {
                        flyline.visible = true;
                    } else {
                        flyline.visible = false;
                    }

                    flyline.material.uniforms.showProgress.value = Math.min(home, wave);
                }
            });

            // 地板中心渐变强度
            floorShader.uniforms.centerIndenty.value = clamp(centerIndenty * 5, 0, 1);

            // 医保监管中心的对应地板的渐变
            floorShader.uniforms.FealthCareCenterIndenty.value = clamp(fealthCareCenter * 5, 0, 1);

            // 基金运行监测中心的对应地板的渐变
            floorShader.uniforms.FundDetectionIndenty.value = clamp(fundDetection * 5, 0, 1);


        });

        return transShowPrograss;
    })();

    // 相机转场的参数
    cameraParam = (() => {
        const cameraParam = new Transition({ positionLength: 0, centerLength: 0 });

        // 相机转场计算
        cameraParam.onChange(({ positionLength, centerLength }) => {
            HomeRenderer.tempVector3.set(this.getCamera().position.x, 0, this.getCamera().position.z);
            HomeRenderer.tempVector3.setLength(positionLength);
            this.getCamera().position.setX(HomeRenderer.tempVector3.x);
            this.getCamera().position.setZ(HomeRenderer.tempVector3.z);

            HomeRenderer.tempVector3.set(this.controls.target.x, 0, this.controls.target.z);
            HomeRenderer.tempVector3.setLength(centerLength);
            this.controls.target.setX(HomeRenderer.tempVector3.x);
            this.controls.target.setZ(HomeRenderer.tempVector3.z);

            this.getCamera().lookAt(this.controls.target);
        });

        return cameraParam;
    })();

    init() {
        super.init();
        this.axesHelper.visible = false;
        this.controlsPosition.reset({ x: 6, y: 6.5, z: 7.5 });
        this.controlsCenter.reset({ x: 0, y: 0, z: 0 });

        // this.controls.dispose();
        this.setControlType("MapControls");

        this.controls.enableDamping = true;
        this.controls.dampingFactor = 0.1;

        this.scene.background = new Color("#071527");

        if (utils.isProd) {
            this.controls.rotateSpeed = 0;
            // this.controls.maxAzimuthAngle = Math.PI * 0.25;
            // this.controls.minAzimuthAngle = Math.PI * 0.25;
            // this.controls.maxPolarAngle = Math.PI * 0.2;
            // this.controls.minPolarAngle = Math.PI * 0.2;
            this.controls.maxDistance = 30;
            this.controls.minDistance = 5;
        }

        Object.assign(this.renderer.domElement.style, {
            position: "absolute",
            zIndex: 2
        });

    }

    // 重置相机的位置
    resetLookAt({
        position,
        center,
    }: {
        position: Vector3,
        center: Vector3
    }) {

        if (position) {
            HomeRenderer.tempVector3.set(position.x, 0, position.z);
            this.cameraParam.reset({ positionLength: HomeRenderer.tempVector3.length() });
        }

        if (center) {
            HomeRenderer.tempVector3.set(center.x, 0, center.z);
            this.cameraParam.reset({ centerLength: HomeRenderer.tempVector3.length() });
        }

        super.resetLookAt({
            position: new Vector3(),
            center
        });
    }

    // 设置控制器的位置 以动画的方式移动控制器
    async setLookAt({
        position,
        center,
        duration = 1000
    }: {
        position: Vector3,
        center: Vector3,
        duration?: number
    }) {
        super.setLookAt({ position, center, duration });

        if (position) {
            HomeRenderer.tempVector3.set(this.getCamera().position.x, 0, this.getCamera().position.z);
            this.cameraParam.reset({ positionLength: HomeRenderer.tempVector3.length() });

            HomeRenderer.tempVector3.set(position.x, 0, position.z);
            this.cameraParam.set({ positionLength: HomeRenderer.tempVector3.length() });
        }

        if (center) {
            HomeRenderer.tempVector3.set(this.controls.target.x, 0, this.controls.target.z);
            this.cameraParam.reset({ centerLength: HomeRenderer.tempVector3.length() });

            HomeRenderer.tempVector3.set(center.x, 0, center.z);
            this.cameraParam.set({ centerLength: HomeRenderer.tempVector3.length() });
        }

        if (duration) {
            this.cameraParam.setDuration(duration);
        }

    }

    // 初始化视角
    initLookat() {
        this.closeLevel3();

        this.transShowPrograss.setDuration(2000);
        this.transShowPrograss.setBezier([0.5, 0.5, 0.5, 0.5]);
        this.transShowPrograss.set({ home: 1, centerIndenty: 1 });

        this.setLookAt({
            center: new Vector3(0, 0, 0),
            position: new Vector3(6, 11, 6)
        });

        this.playWave();
    }

    // 播放小波浪动画
    playWave() {
        this.transShowPrograss.reset({ wave: 0 });
        this.transShowPrograss.set({ wave: 1 });
    }

    // 关闭全部三级菜单
    closeLevel3 = () => {
        this.transShowPrograss.reset({
            healthAgency: 0, // "医保经办管理中心"
            fealthCareCenter: 0,// "医保监管指挥中心"
            fundDetection: 0, // "基金运行监测中心"
            agreementPay: 0, // "协议支付监管中心"
            purchase: 0, // "招标采购管理中心"
            medicalServices: 0, // "医药服务管理中心"
            publicService: 0, // "公共服务监测中心"
            medicinePrice: 0,// "医药价格监测中心"
            threeHospital: 0, // "三医联动控制中心"
            centerIndenty: 0, // 中心地板的渐变强度
        });
    }



    // 切换二级菜单的风格
    switchLevel2LableStyle(isGrey: boolean) {
        this.btnGroup.traverse(obj => {
            const lable = obj as ImgSprite;
            const { level2lable, greyImg, activeImg } = lable.userData;
            if (level2lable) {
                lable.setSrc(isGrey ? greyImg : activeImg);
            }
        });
    }

    setSize(width: number, height: number) {
        super.setSize(width, height);
    }

    render() {
        const hasRender = super.render();
        return hasRender;
    }


}

const homeRenderer = new HomeRenderer();

export default homeRenderer;